<script>
    function getUserData(){
        setTimeout(() => {
            let data="用户数据";
            iterator.next(data);
        }, 1000);
    }

    function getOrderData(){
        setTimeout(() => {
            let data="订单数据";
            iterator.next(data);
        }, 1000);
    }

    function getProductData(){
        setTimeout(() => {
            let data="产品数据";
            iterator.next(data);
        }, 1000);
    }

    function * gen(){
       let userData=yield getUserData();
       console.log(userData);
       let orderData=yield getOrderData();
       console.log(orderData);
       let productData=yield getProductData();
       console.log(productData);
    }

    const iterator=gen();
    iterator.next();

</script>